<#include "header.htm"/>
<#import "../macros/pagination.ftl" as pagination>
<#import "../macros/presentation.ftl" as presentation/>

<script type="text/javascript" src="${contextPath}/templates/${templateName}/js/pagination.js?${startupTime}"></script>

<table cellspacing="0" cellpadding="1" width="100%" align="center" border="0">
	<tr>
		<td class="bodyline" valign="top">
		
			<table cellspacing="0" cellpadding="2" width="100%" align="center" border="0">
				<tr>
					<td valign="bottom" align="left">
						<#assign breadCrumb>
							<a class="nav" href="${JForumContext.encodeURL("/forums/list")}">${I18n.getMessage("ForumListing.forumIndex")}</a> &raquo;
							<a class="nav" href="${JForumContext.encodeURL("/user/profile/${u.id}")}">${I18n.getMessage("UserProfile.profileFor")} ${u.username}</a> 
							&raquo;
							<a class="nav" href="${JForumContext.encodeURL("/recentTopics/showTopicsByUser/${u.id}")}">${I18n.getMessage("ForumListing.userTopics")} ${u.username?html}</a>
						</#assign>
						${breadCrumb}
					</td>
					<td align="right">
						<#assign paginationData>
							<@pagination.doPagination action, u.id/>
						</#assign>
						${paginationData}
					</td>
				</tr>
			</table>
			
			<table class="forumline" cellspacing="1" cellpadding="1" width="100%" border="0">
			   <tr>
					<th class="thcornerl" nowrap="nowrap" align="center" width="120">&nbsp;${I18n.getMessage("Forums.Form.ForumName")}&nbsp;</th>
					<th class="thtop" nowrap="nowrap" align="center"  >&nbsp;${I18n.getMessage("ForumBase.state")}&nbsp;</th>			
					<th class="thtop" nowrap="nowrap" align="center"  >&nbsp;${I18n.getMessage("ForumIndex.topics")}&nbsp;</th>
					<th class="thtop" nowrap="nowrap" align="center" width="50">&nbsp;${I18n.getMessage("ForumIndex.answers")}&nbsp;</th>
					<th class="thtop" nowrap="nowrap" align="center" width="100">&nbsp;${I18n.getMessage("ForumIndex.author")}&nbsp;</th>
					<th class="thtop" nowrap="nowrap" align="center" width="50">&nbsp;${I18n.getMessage("ForumIndex.views")}&nbsp;</th>
					<th class="thcornerr" nowrap="nowrap" align="center" width="100">&nbsp;${I18n.getMessage("ForumIndex.lastMessage")}&nbsp;</th>	
			   </tr>
               
				<!-- TOPICS LISTING -->
				<#list topics as topic>
				<tr>
				
				 <#assign forum = forums.get(topic.forumId)/>
                 <#assign rowbg><@presentation.rowbg topic/></#assign>
					<td  bgcolor="${rowbg}"    valign="middle" align="center" width="120" ><a class="postdetails" href="${JForumContext.encodeURL("/forums/show/${forum.id}")}">${forum.name?html}</a></td>
				
					<td  bgcolor="${rowbg}"   valign="middle" align="center" width="26"><@presentation.folderImage topic/></td>
					<td  bgcolor="${rowbg}" onmouseover="style.backgroundColor='#F5EFFB'" onmouseout="style.backgroundColor='${rowbg}'" >
						<span class="topictitle">
						<a href="${JForumContext.encodeURL("/posts/list/${topic.id}")}" title="最后回复(${topic.lastPostBy.username}):${topic.lastPostText}"><#if (topic.title?length == 0)>${I18n.getMessage("ForumBase.noTopic")}<#else>${topic.title?html}</#if></a>
						</span>
					</td>

					<td  bgcolor="${rowbg}"  valign="middle" align="center" nowrap="nowrap"><span class="postdetails">${topic.totalReplies}</span></td>
					<td  bgcolor="${rowbg}"  valign="middle" align="center" nowrap="nowrap">
					    <span class="name">${topic.firstPostTime}</span><br />
						<span class="name"><a href="${JForumContext.encodeURL("/user/profile/${topic.postedBy.id}")}">${topic.postedBy.username?html}</a></span>
					</td>

					<td  bgcolor="${rowbg}"  valign="middle" nowrap="nowrap" align="center"><span class="postdetails">${topic.totalViews}</span></td>
					<td  bgcolor="${rowbg}"  valign="middle" nowrap="nowrap" align="center">
						<#if (topic.lastPostTime?length > 0)>
							<span class="postdetails">${topic.lastPostTime}<br />
							<a href="${JForumContext.encodeURL("/user/profile/${topic.lastPostBy.id}")}">${topic.lastPostBy.username?html}</a>

							<#assign startPage = ""/>
							<#if (topic.totalReplies + 1 > postsPerPage?number)>
								<#assign startPage = ((topic.totalReplies / postsPerPage?number)?int * postsPerPage?number) +"/"/>
							</#if>
				  
							<a href="${JForumContext.encodeURL("/posts/list/${startPage}${topic.id}")}#${topic.lastPostId}"><img src="${contextPath}/templates/${templateName}/images/icon_latest_reply.gif" border="0" alt="[Latest Reply]" /></a></span>
						</#if>		 
					</td>

					

				</tr>
				</#list>		
				<!-- END OF TOPICS LISTING -->
				
			</table>
			<table cellspacing="0" cellpadding="2" width="100%" align="center" border="0">
				<tr>
					<td valign="bottom" align="left">
						${breadCrumb}
					</td>
					<td align="right">${paginationData}</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
<#include "bottom.htm"/>
